from PIL import Image
import os

# im = Image.open(r"F:\403\车载\限速牌\限速标牌素材（标准）\限速标牌素材（标准）\美国标准标牌\95.eps")
# im.save(r"F:\403\ImgOutput\AmericaSpeedLimit\work.jpg", "JPEG")

InputPath = r"I:\Temp4"
OutputPath = r"I:\Temp4"
for root, dirs, files in os.walk(InputPath):
    RootSplit = root.split("\\")
    RootSplit = "\\".join(RootSplit[5:])
    if os.path.exists(OutputPath + "\\" + RootSplit) is False:
        os.makedirs(OutputPath + "\\" + RootSplit)
    for file in files:
        if file[-1] == 's':
            im = Image.open(root + "\\" + file)
            # im = im.resize((300, 300))
            file = file.replace("eps", "jpg")
            im.save(OutputPath + "\\" + RootSplit + "\\" + file, "JPEG")
    print("文件夹（不包括子文件夹）  %s  转换完成" % root)

print("------------------------------done-------------------------------------")
